/*
 * @Author: fah 1742484532@qq.com
 * @Date: 2024-09-12 11:37:16
 * @LastEditors: fah 1742484532@qq.com
 * @LastEditTime: 2024-09-12 17:39:22
 * @FilePath: \livetree-admin-server\src\lives\entities\live.entity.ts
 * @Description: 指飞部-企业数字化管理系统
 * @version: 1.0
 */

import { Photo } from 'src/photos/entities/photo.entity';
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';

@Entity()
export class Live {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({
    length: 100,
  })
  title: string;

  @Column({
    length: 100,
  })
  content: string;

  @Column({
    default: 0,
  })
  poster_user_id: number;

  @Column({
    default: '',
    length: 32,
  })
  avatar: string;

  @Column({
    default: 0,
  })
  latitude: number;

  @Column({
    default: 0,
  })
  longitude: number;

  @Column({ default: 0 })
  like_count: number;

  @Column({ default: 0 })
  view_count: number;

  @OneToMany((type) => Photo, (photo) => photo.live)
  photos: Photo;

  @Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
  create_time: Date;

  @Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
  update_time: Date;
}
